<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let obj = {
        a: 5,
        b: 6,
        c: 9,
        d: 20,
        e: 11,
        f: 18,
      };
      let arr = Object.keys(obj).map((item) => {
        return {
          value: obj[item],
          key: item,
        };
      });
      let gap = Math.floor(arr.length / 2);
      for (gap; gap > 0; gap = Math.floor(gap / 2)) {
        console.log(gap);
        for (let i = gap; i < arr.length; i++) {
          let temp = arr[i].value;
          let j = i - gap;
          for (j; j >= 0 && temp > arr[j].value; j -= gap) {
            arr[j + gap].value = arr[j].value;
          }
          arr[j + gap].value = temp;
        }
      }
      console.log(arr);
    </script>
  </body>
</html>
